<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文件上传</title>
</head>
<body>
<form action="/upload" method="post" enctype="multipart/form-data">
<!--    // 图片上传-->
    <input id="rightupload" type="file" name="file" value=""/>
    <img id="usrightimg" src="/static/user/img/portrait_photos.png" alt="">

    <br>
    <input value="提交" type="submit">
</form>

<script type="text/javascript" src="../../../../../shop-manager/src/main/resources/static/css/jquery-3.4.1.js"></script>
<script>
    $('#rightupload').change(function () {
        var file = $('#rightupload').get(0).files[0];
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (e) {
            $('#usrightimg').get(0).src = e.target.result;
        }
    })
</script>
</body>
</html>